package com.jxw.launcher;

import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.jxw.launcher.model.AIeye;
import com.jxw.launcher.util.IflytekUtil;
import java.util.ArrayList;

/* loaded from: classes.dex */
public class MyFragmentAr extends BaseFragment {
    private static final String TAG = "MyFragment1";
    private RelativeLayout cloud;
    private ArrayList<AIeye> gridList;
    private ImageView ivRocket;
    private String[] text1s = new String[8];
    private String[] text2s = new String[8];
    private String[] text3s = new String[8];
    private String[] text4s = new String[8];
    private boolean isStop = true;

    @Override // android.support.v4.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflater = inflater(layoutInflater, viewGroup, R.layout.fg_content_ar);
        this.ivRocket = (ImageView) inflater.findViewById(R.id.ivRocket);
        this.cloud = (RelativeLayout) inflater.findViewById(R.id.cloud);
        if (this.gridList == null) {
            this.gridList = new ArrayList<>();
        }
        Log.i(TAG, "initData: ");
        addList();
        return inflater;
    }

    private void startTranslateAnimation() {
        final TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, -800.0f);
        translateAnimation.setFillAfter(false);
        translateAnimation.setDuration(900L);
        translateAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.jxw.launcher.MyFragmentAr.1
            @Override // android.view.animation.Animation.AnimationListener
            public void onAnimationRepeat(Animation animation) {
            }

            @Override // android.view.animation.Animation.AnimationListener
            public void onAnimationStart(Animation animation) {
                MyFragmentAr.this.ivRocket.setVisibility(0);
                MyFragmentAr.this.cloud.setVisibility(0);
            }

            @Override // android.view.animation.Animation.AnimationListener
            public void onAnimationEnd(Animation animation) {
                MyFragmentAr.this.ivRocket.setVisibility(8);
                MyFragmentAr.this.cloud.setVisibility(8);
                Toast.makeText(MyFragmentAr.this.getActivity(), "清理完成!", 0).show();
            }
        });
        this.ivRocket.setVisibility(0);
        this.cloud.setVisibility(0);
        AnimationDrawable animationDrawable = (AnimationDrawable) this.ivRocket.getBackground();
        if (!animationDrawable.isRunning()) {
            animationDrawable.start();
        }
        this.ivRocket.postDelayed(new Runnable() { // from class: com.jxw.launcher.MyFragmentAr.2
            @Override // java.lang.Runnable
            public void run() {
                MyFragmentAr.this.ivRocket.startAnimation(translateAnimation);
            }
        }, 1000L);
    }

    @Override // android.support.v4.app.Fragment
    public void onStop() {
        super.onStop();
    }

    @Override // android.support.v4.app.Fragment
    public void onPause() {
        super.onPause();
        Log.i(TAG, "onPause: ");
    }

    private void addList() {
        if (this.gridList.size() > 0) {
            this.gridList.clear();
        }
        this.text1s = new String[]{"查单词", "翻译", "查询", "互问互答", "娱乐", "时间与闹钟", "天气", "打开应用"};
        this.text2s = new String[]{"苹果用英文怎么说", "我要去上学用英文怎么说", "百家姓有哪些", "卫生纸属于什么垃圾", "我想听笑话", "每天早上8点提醒我背单词", "今天天气怎么样", "打开错题本"};
        this.text3s = new String[]{"funny用中文怎么说", "星期六的英文单词", "中国的首都在哪里", "香蕉的热量是多少", "我想听下雨的声音", "设置晚上9点的闹钟", "明天是阴天吗？", "我想评测单词"};
        this.text4s = new String[]{"young的中文", "翻译一下a wonderful day", "5月8日出生是什么星座", "有什么经典名句吗", "我想看郭德纲的小品", "这周三是几月几号", "这周六热不热", "我要翻译"};
        for (int i = 0; i < 8; i++) {
            AIeye aIeye = new AIeye();
            aIeye.setText1(this.text1s[i]);
            aIeye.setText2(this.text2s[i]);
            aIeye.setText3(this.text3s[i]);
            aIeye.setText4(this.text4s[i]);
            this.gridList.add(aIeye);
        }
    }

    /* loaded from: classes.dex */
    public static class PlaceholderFragment extends Fragment {
        private static final String ARG_SECTION_NUMBER = "section_number";
        private static final String ARG_SECTION_STRING = "section_string";
        public static Context context;

        public static PlaceholderFragment newInstance(ArrayList<AIeye> arrayList, int i) {
            PlaceholderFragment placeholderFragment = new PlaceholderFragment();
            Bundle bundle = new Bundle();
            bundle.putSerializable(ARG_SECTION_STRING, arrayList);
            bundle.putInt(ARG_SECTION_NUMBER, i);
            placeholderFragment.setArguments(bundle);
            return placeholderFragment;
        }

        @Override // android.support.v4.app.Fragment
        public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
            View inflate = layoutInflater.inflate(R.layout.ai_gridview_item, viewGroup, false);
            final ArrayList arrayList = (ArrayList) getArguments().getSerializable(ARG_SECTION_STRING);
            final int intValue = ((Integer) getArguments().get(ARG_SECTION_NUMBER)).intValue();
            TextView textView = (TextView) inflate.findViewById(R.id.text1);
            TextView textView2 = (TextView) inflate.findViewById(R.id.text2);
            TextView textView3 = (TextView) inflate.findViewById(R.id.text3);
            TextView textView4 = (TextView) inflate.findViewById(R.id.text4);
            textView.setText("" + ((AIeye) arrayList.get(intValue)).getText1());
            textView2.setText("" + ((AIeye) arrayList.get(intValue)).getText2());
            textView3.setText("" + ((AIeye) arrayList.get(intValue)).getText3());
            textView4.setText("" + ((AIeye) arrayList.get(intValue)).getText4());
            textView.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.launcher.MyFragmentAr.PlaceholderFragment.1
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    if (IflytekUtil.isRun) {
                        Log.i(MyFragmentAr.TAG, "onClicdk: 在运行");
                        IflytekUtil.startiflytek(PlaceholderFragment.this.getActivity(), ((AIeye) arrayList.get(intValue)).getText1());
                        return;
                    }
                    Log.i(MyFragmentAr.TAG, "onClicdk: 不在运行");
                    IflytekUtil.isRun = true;
                    MyApp.getInstance().mBottomBtnOnClickListener.onClick(PlaceholderFragment.this.getResources().getString(R.string.tag_args_znyy));
                }
            });
            textView2.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.launcher.MyFragmentAr.PlaceholderFragment.2
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    if (IflytekUtil.isRun) {
                        Log.i(MyFragmentAr.TAG, "onClicdk: 在运行");
                        IflytekUtil.startiflytek(PlaceholderFragment.this.getActivity(), ((AIeye) arrayList.get(intValue)).getText2());
                        return;
                    }
                    Log.i(MyFragmentAr.TAG, "onClicdk: 不在运行");
                    IflytekUtil.isRun = true;
                    MyApp.getInstance().mBottomBtnOnClickListener.onClick(PlaceholderFragment.this.getResources().getString(R.string.tag_args_znyy));
                }
            });
            textView3.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.launcher.MyFragmentAr.PlaceholderFragment.3
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    if (IflytekUtil.isRun) {
                        Log.i(MyFragmentAr.TAG, "onClicdk: 在运行");
                        IflytekUtil.startiflytek(PlaceholderFragment.this.getActivity(), ((AIeye) arrayList.get(intValue)).getText3());
                        return;
                    }
                    Log.i(MyFragmentAr.TAG, "onClicdk: 不在运行");
                    IflytekUtil.isRun = true;
                    MyApp.getInstance().mBottomBtnOnClickListener.onClick(PlaceholderFragment.this.getResources().getString(R.string.tag_args_znyy));
                }
            });
            textView4.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.launcher.MyFragmentAr.PlaceholderFragment.4
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    if (IflytekUtil.isRun) {
                        Log.i(MyFragmentAr.TAG, "onClicdk: 在运行");
                        IflytekUtil.startiflytek(PlaceholderFragment.this.getActivity(), ((AIeye) arrayList.get(intValue)).getText4());
                        return;
                    }
                    Log.i(MyFragmentAr.TAG, "onClicdk: 不在运行");
                    IflytekUtil.isRun = true;
                    MyApp.getInstance().mBottomBtnOnClickListener.onClick(PlaceholderFragment.this.getResources().getString(R.string.tag_args_znyy));
                }
            });
            return inflate;
        }
    }
}
